home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 2⁄2⁄90 / 0582-OpenOld without the -Jan90 < prev    next >
Encoding:
Text File  |  1990-02-02  |  3.7 KB  |  95 lines  |  [TEXT/GEOL]

  1. Item    7235502                         31-Jan-90        20:08PST
  2.  
  3. From:   D4453                           Technically Soft, Chris Lang,PRT
  4.  
  5. To:     MADA2                           MacApp Dev Assoc, Curtis Faith,IVC
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    OpenOld without the SFDlog
  10.  
  11. Dear Curtis;
  12.  
  13. After slaving over this thing for a couple of days now I'm no futher along.
  14.  
  15. Basically I want to open a file right after my Application starts up.  The
  16. default directory is in my case .Debug Files folder of myApp folder.  I want to
  17. open Index-1 at 'Hard:MPW:WellPilot:.Debug Files:Empty Folder:Index-1'.  I
  18. store all the information about Index-1 in a Rsrc of WellPilot (when its was
  19. originally saved or I can "Set Index" to update the stored info about the
  20. file).  Ideally I would like to call openOld and pass it the info stored in
  21. those rsrc forks but I get OSerr -35 (no Volume by that reference ).  I think
  22. the problem stems from the fact that "Empty Folder" is not a working directory
  23. and I can't seem to make it one.  Here is the code for GetIndex.  Its suppose
  24. to do just what OpenOld does.  The only difference is that when MacApp calls
  25. openOld it first promts you for the working Directory via the SFDialog.
  26.  
  27. Procedure TWellPilotApplication.GetIndex;
  28. VAR i, error : Integer;
  29.         aStr : Str255;
  30.         theBlk : HParamBlockRec;
  31.         dataRefNum,rsrcRefNum : Integer;
  32.         Pb : WDPBrec;
  33. begin
  34.         With theBlk do begin
  35.                 ioCompletion:=nil;
  36.                 aStr:='Hard:MPW:WellPilot:.Debug Files:Empty Folder:Index-1';
  37.                 ioNamePtr:=@aStr;
  38.                 ioVRefNum:=-32621;  { I know this is correct }
  39.                 ioFDirIndex:=0;
  40.                 ioDirID:=0;
  41.            end;
  42.         FailOSErr(PBHGetFInfo(@theBlk,false));        { Works wonderfully no error }
  43.  
  44.         with Pb do begin        { same stuff as above }
  45.                 ioNameptr:=theBlk.ioNamePtr;
  46.                 ioVRefNum:=theBlk.ioVRefNum;
  47.                 ioWDIndex:=0;
  48.                 ioWDProcID:=0;
  49.                 ioWDVRefNum:=ioVRefNum
  50.             end;
  51.         error:=PBOpenWD(@Pb,false);
  52.         If Error<>noErr then begin
  53.                 Writeln('error in PBOpenWD ',error);            { error -120  }
  54.                 Pb.ioWDVRefNum:=6241;           { this is correct WDDir }
  55.                 error := PBGetWDInfo(@Pb,false);
  56.                 If Error<>NoErr then begin
  57.                         Writeln('error in PBOpenWD ',error);             { error -35  }
  58.                         ProgramBreak('Failed both times');
  59.                 end;
  60.         end;
  61.     error:=PBGetWDInfo(@Pb,false);
  62.         If Error<>noErr then begin
  63.                 Writeln('error in PBGetWDInfo ',error); {error -35 of course }
  64.                 Pb.ioWDVRefNum:=6241;
  65.                 error := PBGetWDInfo(@Pb,false);
  66.                 If Error<>NoErr then begin
  67.                             Writeln('error in PBGetWDInfo ',error);
  68.                             ProgramBreak('Failed both times');
  69.                 end;
  70.         end;
  71.         error:=MAOpenFile(aStr,
  72.                         theBlk.ioVRefNum,        { volRefNum }
  73.                                         true,                    { opendata }
  74.                                         false,                    { openrsrc }
  75.                                         fsRdWrPerm,                { exclusive read/write Permission 3 }
  76.                                         fsRdWrPerm,                { the rsrc fork also }
  77.                                         dataRefNum,                { returned }
  78.                                         rsrcRefNum);            { also returned }
  79.         If error<>NoErr then
  80.             ProgramBreak('ma open failed')
  81.         else Writeln('OK so far');
  82. end;
  83.  
  84. In a nut shell.  Calling OpenWD with the info given above yields either error
  85. -35, volume not found,  or -120, directory not found.  I can't call PBGetWDInfo
  86. without first Opening the Working Directory.  And of course MAOpenFile fails
  87. because PBGetWDInfo fails which is called within MAOpenFile.  OpenOld calls
  88. OpenAFile which in turn calls MAOpenFile and the circle ends with error -35.
  89. Why can't I correctly call OpenWD??
  90.  
  91. Thanks again
  92. Chris Lang @D4453
  93.  
  94.  
  95.